<?php

namespace app\libs\SpreedlySDK\Action;

use app\libs\SpreedlySDK\SpreedlyClient;

class GatewaysAPI extends SpreedlyClient
{
    /**
     * @param array $body
     * @return mixed|null
     * @throws \GuzzleHttp\Exception\GuzzleException
     * @desc 创建网关
     * @doc https://developer.spreedly.com/reference/create-gateways
     */
    public function create_gateways(array $body)
    {
        return $this->setPath(sprintf("/%s/gateways.json",self::API_VERSION))
                    ->setOption(['json'=>$body])
                    ->setMethod(self::HTTP_METHOD_POST)
                    ->send();
    }

    public function check_env($env)
    {
        return $this->setPath(sprintf("/%s/environments/%s.json",self::API_VERSION,$env))
            ->setMethod(self::HTTP_METHOD_GET)
            ->send();
    }
}